package com.some;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class RedBook_02 {
    public static String isContains(String oldStr, String newStr) {
        if (oldStr.contains(newStr)) {
            return "yes";
        }
        if (oldStr.length() == newStr.length() && !oldStr.equals(newStr)) {
            return "no";
        }
        char[] oldArr = oldStr.toCharArray();
        char[] newArr = newStr.toCharArray();
        int index = 0;
        for (char c : oldArr) {
            if (c == newArr[index]) {
                index++;
            }
            if (index == newStr.length()) {
                return "yes";
            }
        }
        return "no";

    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        List<String> list = new ArrayList<>(n);
        for (int i = 0; i < n; i++) {
            String oldStr = sc.next();
            String newStr = sc.next();
            list.add(isContains(oldStr, newStr));
        }
        for (String s : list) {
            System.out.println(s);
        }
    }
}
